var arr = [3322, 245, 387, 2, 1246];
var max = Math.max(...arr);
var min = Math.min(...arr);
console.log("最大数：" + max + "，最小数：" + min);